function affirm() {
    var name = document.getElementById("name").value;
    var pas = document.getElementById("password").value;
    var affpas = document.getElementById("affirmPassword").value;
    console.log(affpas);
    for (let i = 0; i < localStorage.length; i++) {
        var key = localStorage.key(i);
        var keydata = localStorage.getItem(key);
        var keyinfo = JSON.parse(keydata);
        if (keyinfo.name == name) {
            alert("账户已存在");
            location.assign("register.html");
            return;
        }
    }
    if (pas != affpas) {
        alert("第二次输入的密码不相同");
        location.assign("register.html");
        return;
    }
    var dataLength = localStorage.length;
    var data = {}
    data.name = name;
    data.pas = pas;
    data.id = dataLength; // 添加用户唯一凭证ID
    let info = JSON.stringify(data); // 将对象转化为字符串   因为本地存储只能存储字符串
    localStorage.setItem("key" + dataLength, info);
    alert("存储成功,点击后跳转到登录页面");
    location.assign("login.html");
};
function enter(){
    var tel = document.getElementById("tel").value;
    var pas = document.getElementById("pas").value;
    for(let i = 0; i < localStorage.length; i++) {
        var key = localStorage.key(i);
        var keydata = localStorage.getItem(key); // 拿到对应数据  只不过这时候是字符串
        var keyinfo = JSON.parse(keydata);
        if(keyinfo.name==tel){
            if(keyinfo.pas==pas){
                alert("登录成功,点击后跳转到介绍页面");
                location.assign("个人介绍.html");
            }
            else{
                alert("密码错误");
            }
            return;
        }
    }
    alert("此账号未注册");
}